package com.phpxiu.app.model.msg;

import com.tencent.TIMMessage;

/**
 * 消息工厂
 */
public class C2CMsgFactory {

    private C2CMsgFactory() {}

    /**
     * 消息工厂方法
     */
    public static C2CMsg getMessage(TIMMessage message){
        switch (message.getElement(0).getType()){
            case Text:
            case Face:
                return new C2CTextMsg(message);
            case Sound:
                return new C2CVoiceMsg(message);
            case Image:
                return new C2CImageMsg(message);
            default:
                return null;
        }
    }

}
